<template>
  <div class="conter">
    <div class="conter-box">
      <div class="text">
        <span class="xinhao">*</span>原密码
      </div>
      <input
      v-model="data.oldpassword"
        type="pass"
        name="sale_price"
        class="chk_tag_param"
        onkeyup="changSelfBuyPyice"
        placeholder="请输入原密码"
        data-min_len="1"
        maxlength="11"
        data-_err_notice="请输入原密码"
      />
    </div>
    <div class="conter-box">
      <div class="text">
        <span class="xinhao">*</span>新密码
      </div>
      <input
      v-model="data.newpassword"
        type="pass"
        name="sale_price"
        class="chk_tag_param"
        onkeyup="changSelfBuyPyice"
        placeholder="请输入新密码"
        data-min_len="1"
        maxlength="11"
        data-_err_notice="请输入新密码"
      />
    </div>
    <div class="conter-box">
      <div class="text">
        <span class="xinhao">*</span>确认密码
      </div>
      <input
      v-model="data.password"
        type="pass"
        name="sale_price"
        class="chk_tag_param"
        onkeyup="changSelfBuyPyice"
        placeholder="请输入确认密码"
        data-min_len="1"
        maxlength="11"
        data-_err_notice="请输入再次输入新密码"
      />
    </div>
    <div class="conter-button">
      <el-button>取消</el-button>
      <el-button type="primary" @click="subtring">确定</el-button>
    </div>
  </div>
</template>
<script>
import {post} from "@/util/http.js";
import { ElMessage } from 'element-plus'
export default {
    data(){
        return{
            data:{
                oldpassword:"",
                newpassword:"",
                password:"",
            }
        }
    },
    methods:{
        subtring(){
            let data = {
                _gp:"admin",
                _mt:"newPassword",
                newPassword :this.data.newpassword,
                oldPassword :this.data.oldpassword,
            }
             post(data).then((res)=>{
                if (200 == res.data.errno) {
                      ElMessage.success("更改密码成功")
                }
                 ElMessage.warning(res.data.errmsg)
            }).catch((err)=>{
                 ElMessage.error(err.data.errmsg)
            })
        }
    }
}
</script>
<style lang="less" scoped>
.conter {
  width: 500px;
  height: 400px;
  border: 1px solid rgb(219, 216, 216);
  margin: auto;
  margin-top: 50px;
  .conter-box {
    display: flex;
    white-space: nowrap;
    margin-top: 40px;
    .text {
      width: 80px;
      height: 40px;
      line-height: 40px;
      margin-left: 50px;
      .xinhao {
        color: red;
      }
    }
    .chk_tag_param {
      width: 300px;
      height: 40px;
      margin-left: 40px;
      border: rgb(241, 239, 239) 1px solid;
      border-radius: 8px 8px 8px 8px;
    }
  }
  .conter-button{
     display: flex;
    white-space: nowrap;
    margin-top: 40px;
    margin-left: 140px;
  }
}
</style>